UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FxqgWL7+CtzS5DCE8tdA5yvgecJXMTDYmfDs2wi3+ww=' 
WHERE 
  key_id = '476c2d216ce5bece483e677f3f0507d4c48471cd88c9df6c7a85429617e874ad' 
  AND (
    token = 'FxqgWL7+CtzS5DCE8tdA5yvgecJXMTDYmfDs2wi3+ww=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029