UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YC4tr6Crpr626djFY/+5zqHCwfCQoSBUXF4yiMDzNYk=' 
WHERE 
  key_id = '5923973f079ea584ab0a30b9ee559fdf5dc504bb85a70da1c7ea26b1c67e2586' 
  AND (
    token = 'YC4tr6Crpr626djFY/+5zqHCwfCQoSBUXF4yiMDzNYk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034