UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'x66mOV3Ey6E0LeTLWPoN3BzsufXXxNiNnJOHOsQ95ik=' 
WHERE 
  key_id = '6d2eb8667fbde3209679f9763c8f0b2032edd867c26e94e240b3f503c75f21e7' 
  AND (
    token = 'x66mOV3Ey6E0LeTLWPoN3BzsufXXxNiNnJOHOsQ95ik=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035