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

Query time 0.00019