UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'w+Pys6fCSHT6MPgRmQBx66fmFX5LQhWYQn21pZARRTQ=' 
WHERE 
  key_id = 'be4cd0cc4198cae766dc980b343a0ead25495b96268ea7ba27e9fcb33ffeb744' 
  AND (
    token = 'w+Pys6fCSHT6MPgRmQBx66fmFX5LQhWYQn21pZARRTQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035