UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vLAhiohdFQKfkOWUoZT7mtil5ehEo9PX+2PR8PdrrEo=' 
WHERE 
  key_id = 'ace9c9013bb3171f9ba93af2532823863f2b7afd9d9071242e441412441bb6a8' 
  AND (
    token = 'vLAhiohdFQKfkOWUoZT7mtil5ehEo9PX+2PR8PdrrEo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046