UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YmSjLICyZshrCQwka9yB8yXKTKZLvLXFXJZFX6ifpnk=' 
WHERE 
  key_id = 'ba7b58ca17ded89e84d85eb24f02e09c37125a6b8b639207eb6657a20365aa34' 
  AND (
    token = 'YmSjLICyZshrCQwka9yB8yXKTKZLvLXFXJZFX6ifpnk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030