UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yW+WgOPnCfit3tdtKoMliyThJ7Oe4xHhKAx5QH7ySog=' 
WHERE 
  key_id = '9205a20e573686d398cba9ec6ed48189645c1e30022613a97c76164f369fbfdc' 
  AND (
    token = 'yW+WgOPnCfit3tdtKoMliyThJ7Oe4xHhKAx5QH7ySog=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044