UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xwS5v/K+sGWQExeWJzsnSUtopze1OgyakgkY1dBnZYs=' 
WHERE 
  key_id = '6dbed779c0c5350596f0873e5011d03d5316370f376de2d44b5105b40e64ceb4' 
  AND (
    token = 'xwS5v/K+sGWQExeWJzsnSUtopze1OgyakgkY1dBnZYs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053