UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lGGvEs5q1XePXTq7dr3MYc0ZV2jhX3rzWGURB/cDF6U=' 
WHERE 
  key_id = 'a3f40addf3f4764a5d4ff9a697fae9b666e08e2e35f6c60bbc553410d84a89ee' 
  AND (
    token = 'lGGvEs5q1XePXTq7dr3MYc0ZV2jhX3rzWGURB/cDF6U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037