UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rL3gYoNJFABMF0Q2eSIb4FLvNt+UIqG/Pq4WN9CVczg=' 
WHERE 
  key_id = '7c935f264f945722cb29035a2688388e81fe0890193f85a13471f4a7bf789837' 
  AND (
    token = 'rL3gYoNJFABMF0Q2eSIb4FLvNt+UIqG/Pq4WN9CVczg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042