UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JRdGiWgMvnkX35iq5GCQelTZ4bX5KQ5yhMez3T/jVoQ=' 
WHERE 
  key_id = 'a1bc3ef737511602b07e94063616bc0c6a3cc2ccad096fd1a958cad4f0e9417b' 
  AND (
    token = 'JRdGiWgMvnkX35iq5GCQelTZ4bX5KQ5yhMez3T/jVoQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031