UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'N2UPueEzJWFIaOgF7b5n1LIbFojgadF/yddWU6UPIrc=' 
WHERE 
  key_id = '7071cd83f4b10ff8a0468e1b6e635aeca48604bfcb559539c7794929b0ac7099' 
  AND (
    token = 'N2UPueEzJWFIaOgF7b5n1LIbFojgadF/yddWU6UPIrc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050