UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'M90c4yKgmHNjADgxdyVoj+ZlvCqnC5gepXekXq9rurE=' 
WHERE 
  key_id = 'a1bc9ca8962c454c0f34029be0924f1c5e126cca3df1146863328356004716aa' 
  AND (
    token = 'M90c4yKgmHNjADgxdyVoj+ZlvCqnC5gepXekXq9rurE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019