UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AqGdrDViofuRcZ2uGTOArkC+YjN74NKhvItk+xN14GU=' 
WHERE 
  key_id = 'b57261387464a0f4844dadae614c2569c1cc1d9f5bf7f10dbcdac42370a02581' 
  AND (
    token = 'AqGdrDViofuRcZ2uGTOArkC+YjN74NKhvItk+xN14GU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032