UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hE9zLeLBeXHDz7v7+YXd+etNrOmvXSps50n187fao4U=' 
WHERE 
  key_id = '08f09e8778d30311db46b9ee6f96da0ca3012d97a60e686bbcd87e4665319dd4' 
  AND (
    token = 'hE9zLeLBeXHDz7v7+YXd+etNrOmvXSps50n187fao4U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016