UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aInpWWTx8ZD/c7hsdpkq/My3ujtgoU5Teg1oqtDkpL8=' 
WHERE 
  key_id = 'df173d187d007758014eab3352c70659df3388da4dd5fd9115ab7618e2561174' 
  AND (
    token = 'aInpWWTx8ZD/c7hsdpkq/My3ujtgoU5Teg1oqtDkpL8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034