UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7tS+tYmVs9bxRw6mh7xoZbYSPv8u/Y0yTri6mOAqw1s=' 
WHERE 
  key_id = '1f817129811d4461f77cd354cb5956f84d5ebb82f122907c174b1b3b918a26df' 
  AND (
    token = '7tS+tYmVs9bxRw6mh7xoZbYSPv8u/Y0yTri6mOAqw1s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047