UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BqoLxfP4VNRpZSLU2WmZlcUaRuhhynDCWEYj1dIH2dU=' 
WHERE 
  key_id = '45a31ec7c199225f804c4267f8f619c433f1959e834b5dd0d56d853c52e060fa' 
  AND (
    token = 'BqoLxfP4VNRpZSLU2WmZlcUaRuhhynDCWEYj1dIH2dU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026