UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'o2KisiPN52xN1ef47N5WbAhrvNfzpwcDHDv244nLZjo=' 
WHERE 
  key_id = 'c7a7a86f0a784d58bfcbdae38e3ffe9a1b05af35f29c89a3162d905e41373ec4' 
  AND (
    token = 'o2KisiPN52xN1ef47N5WbAhrvNfzpwcDHDv244nLZjo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018