UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'd+xcBirntTIcpq/2Ihbc4bcl+L9Qlh4i89PeOflxqEw=' 
WHERE 
  key_id = 'e1f0e9c461fdfd94f40782f1d15878016440433a15d369cd4e9967b681511370' 
  AND (
    token = 'd+xcBirntTIcpq/2Ihbc4bcl+L9Qlh4i89PeOflxqEw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040