UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7Z9jAU8vPnMwmLf+6kz8JD40ELGxxq9Wowq90AunXJM=' 
WHERE 
  key_id = '2a3da122652bda46fbccb289e3c38f8e0dff3725cd21b1035c15d143b0314350' 
  AND (
    token = '7Z9jAU8vPnMwmLf+6kz8JD40ELGxxq9Wowq90AunXJM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046