UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8di500ooOeB+zJxp1TTE8sAY30kpl9flqvsgx8iCDFU=' 
WHERE 
  key_id = 'e78256ac9cdb4768a4371879dd0e0a7aae8ac600892f1f3c6ed650b89d63f92b' 
  AND (
    token = '8di500ooOeB+zJxp1TTE8sAY30kpl9flqvsgx8iCDFU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032