UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0pPqy5z7vDHipk+1h071lvViOqoBhTYCADmpZUFjExY=' 
WHERE 
  key_id = 'ee919bbc144bd19995c529ee731536a9cd438db1477feee9469939fd6055f352' 
  AND (
    token = '0pPqy5z7vDHipk+1h071lvViOqoBhTYCADmpZUFjExY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036