UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oTIpctoin9xk31eN50EInJvTORqRAoj7F4sYFEC5q9A=' 
WHERE 
  key_id = 'de056d8ea3e8851758342bde2e468d210f833be8dffb309ef6776169b5cee438' 
  AND (
    token = 'oTIpctoin9xk31eN50EInJvTORqRAoj7F4sYFEC5q9A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034