UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RR2I15ABTpkXCuxduvCU0slxap8Uy+FJkR5gPK07sbc=' 
WHERE 
  key_id = '9b874bc852b64ac8e955e46f4e7b0a8c7cd26dcc2419fc1d5fbe99f8e1d6e32d' 
  AND (
    token = 'RR2I15ABTpkXCuxduvCU0slxap8Uy+FJkR5gPK07sbc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044