UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cy+CKGj41xOk/6MoqWOftQYEKcMjq1ds9QEeY6euyqQ=' 
WHERE 
  key_id = 'dff7a1c45f7ffcc87c55f862a3206c69abffba89d1e42ed1e2c61eb7b2ad2432' 
  AND (
    token = 'cy+CKGj41xOk/6MoqWOftQYEKcMjq1ds9QEeY6euyqQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030