UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gY7wuBtJVRCH9XnEOnXzWF/eL24v0HybE1OtmDIWeOc=' 
WHERE 
  key_id = 'a64d78e3ab1816a98de72c1fe11776bcdd3faee0700df0f8aab1619952ccff66' 
  AND (
    token = 'gY7wuBtJVRCH9XnEOnXzWF/eL24v0HybE1OtmDIWeOc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036