UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Pir3T4uIvoknfjxPbJIrqiRMx4g/h8SSbQXCoHr4bCo=' 
WHERE 
  key_id = 'd44fa1928a163a05831069017bb9dad3e621256b397a27d91098610684782588' 
  AND (
    token = 'Pir3T4uIvoknfjxPbJIrqiRMx4g/h8SSbQXCoHr4bCo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035