UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VW+z13AT9jQRYxs5PgAiSDnEqqF91snRdIia9yC4fow=' 
WHERE 
  key_id = '6170bb3c01115dc2ca2e9071c32a24df27d451cb28846c88f69a0a3f451c6c8e' 
  AND (
    token = 'VW+z13AT9jQRYxs5PgAiSDnEqqF91snRdIia9yC4fow=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052