UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QeD/scEUBs9zCq9+Jz6E+FNWqWd7QWhrq18UntUt/Ys=' 
WHERE 
  key_id = '8eac58c7de72216f377b2896450a268f148c0fa76d91f8b70785a46828db2fc5' 
  AND (
    token = 'QeD/scEUBs9zCq9+Jz6E+FNWqWd7QWhrq18UntUt/Ys=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032