UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'h9+Qd5PUSphoocNNxhNL6uCon7Ykko9UJpLka8KGueM=' 
WHERE 
  key_id = '9c6d8304d515dcbfc636af2cf57702a90dfb30742973fe896532af69920fee18' 
  AND (
    token = 'h9+Qd5PUSphoocNNxhNL6uCon7Ykko9UJpLka8KGueM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028