UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Xhp+PzkgJq0+h/QdfbYlsc8xMioxsc3sUbRQSG5ZDic=' 
WHERE 
  key_id = 'ca6b0701a38645bec6e4c7887ef5062140a11767eedacb1b272513b59d602473' 
  AND (
    token = 'Xhp+PzkgJq0+h/QdfbYlsc8xMioxsc3sUbRQSG5ZDic=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021