UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xAR8BtLTjtDLmXNBfAtAN+d0peh4Y/fv2oZPED8lqMM=' 
WHERE 
  key_id = 'ebd4ece5018fa3a31f2ae7396533f07fa87ecec0fcb5141b0999827c568dd189' 
  AND (
    token = 'xAR8BtLTjtDLmXNBfAtAN+d0peh4Y/fv2oZPED8lqMM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025